package com.freight.tws.controller;

import lombok.RequiredArgsConstructor;
import com.freight.common.security.annotation.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.freight.common.log.annotation.Log;
import com.freight.common.log.enums.BusinessType;
import com.freight.common.core.web.controller.BaseController;
import com.freight.common.core.web.domain.AjaxResult;
import com.freight.tws.api.domain.PtQy;
import com.freight.tws.service.IPtQyService;

/**
 * 运营方信息(平台运营方)Controller
 * 
 * @author ruoyi
 * @date 2022-01-18
 */
@RequiredArgsConstructor(onConstructor_ = @Autowired)
@RestController
@RequestMapping("/qy")
public class PtQyController extends BaseController {
    private final IPtQyService iPtQyService;

    /**
     * 查询运营方信息(平台运营方)列表
     */
    @PreAuthorize(hasPermi="tws:qy:list")
    @GetMapping("/list")
    public AjaxResult list() {
        return AjaxResult.success(iPtQyService.lists());
    }

    /**
     * 获取运营方信息(平台运营方)详细信息
     */
    @PreAuthorize(hasPermi="tws:qy:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id) {
        return AjaxResult.success(iPtQyService.getInfo(id));
    }

    /**
     * 修改运营方信息(平台运营方)
     */
    @PreAuthorize(hasPermi="tws:qy:edit")
    @Log(title = "运营方信息(平台运营方)" , businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PtQy ptQy) {
        return toAjax(iPtQyService.edit(ptQy) ? 1 : 0);
    }

}
